class_name BattleUnit
extends Area2D

# ===============================================

@export var stats: UnitStats :
	set(value):
		stats = value
		if not stats or not is_instance_valid(tier_icon):
			return
		stats = value.duplicate()
		collision_layer = stats.team + 1
		
		skin.texture = UnitStats.TEAM_SPRITESHEET[stats.team]
		skin.coordinates = stats.skin_coordinates
		skin.flip_h = stats.team == stats.Team.PLAYER
		tier_icon.stats = stats

# ===============================================

@onready var skin: PackedSprite2D = $Skin
@onready var health_bar: ProgressBar = $HealthBar
@onready var mana_bar: ProgressBar = $ManaBar
@onready var tier_icon: TierIcon = $TierIcon
@onready var animation_player: AnimationPlayer = $AnimationPlayer

# ===============================================
